package com.shuma.upms.user.api.feign;

import com.shuma.upms.user.domain.entity.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * 调用权限服务的 Feign 客户端
 */
@FeignClient(name = "permission-service")
public interface PermissionServiceFeignClient {

    // 绑定默认角色
    @PostMapping("/rpc/permission/bind-default")
    Result bindDefaultRole(@RequestParam("userId") Long userId);

    // 获取用户角色代码
    @GetMapping("/rpc/permission/user-role-code")
    Result<String> getUserRoleCode(@RequestParam("userId") Long userId);

    // 升级为管理员
    @PostMapping("/rpc/permission/upgrade-to-admin")
    Result upgradeToAdmin(@RequestParam("userId") Long userId);

    // 降级为普通用户
    @PostMapping("/rpc/permission/downgrade-to-user")
    Result downgradeToUser( @RequestParam("userId") Long userId);
}